package des.yordan.mihaylov;

import java.util.Random;

/**
 * @author Yordan Mihaylov
 * @version 2011/06/07
 */

public class RandVar extends Random {

	public RandVar() {
		super();
	}

	public RandVar(int seed) {
		super(seed);
	}

	/**
	 * Generates a random number from an exponential distribution with
	 * expectation 1/lambda I use StrictMath to ensure strict reproducibility..
	 * 
	 * @param lambda
	 *            1/E(X)
	 * @return exponentially distributed random number
	 */
	public long getLongRV(double lambda) {

		double x = nextDouble();
		return (long) (-StrictMath.log(x) * SimState.sec_prescaler / lambda);
	}

	private static final long serialVersionUID = 1L;
}
